<?php


namespace App\Http\Controllers\Api;

use App\Services\Base\Interfaces\ConfigServiceInterface;
use App\Services\Base\Services\ConfigService;


use  App\Services\Member\Interfaces\UserServiceInterface;
use App\Services\Member\Services\UserService;
use App\Services\Member\Interfaces\NotificationServiceInterface;
use App\Services\Member\Services\NotificationService;
use  App\Services\Business\Services\ConquerService;
use App\Services\Business\Interfaces\ConquerServiceInterface;
use App\Zesow\Cache\Impl\SliderCache;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class HomeController extends BaseController
{


    public function home(Request $request,SliderCache  $sliderCache)
    {


        /**
         * @var $conquerService ConquerService
         */
        $conquerService = app()->make(ConquerServiceInterface::class);


        /**
         * @var  $userService UserService
         */
        $userService = app()->make(UserServiceInterface::class);



        /**
         * @var  $notificationService NotificationService
         */
        $notificationService = app()->make(NotificationServiceInterface::class);


        /**
         * @var $configService ConfigService
         */
        $configService = app()->make(ConfigServiceInterface::class);


        // 推荐课程
        $gSliderBanners =  $sliderCache->get();


        $conquers = $conquerService->getRecommendConquer();

        //动态数据

        $unreadFeedCount  = $this->check()? $userService->unreadFeedCount($this->id()):0;

        //未读通知
        $unreadMessageCount = $this->check()? $notificationService->getUnreadCount($this->id()) : 0;


        // zesow配置
        $config = $configService->getZeSowConfig();

        return $this->data(compact('gSliderBanners','config','unreadFeedCount','unreadMessageCount','conquers'));

    }






}
